|
Code location |
Code |
Model object |
Details |
|
1 |
/*
|
|
Nonfunctional code (Comment) |
|
2 |
* File: pitch_ap.c
|
|
Nonfunctional code (Comment) |
|
3 |
*
|
|
Nonfunctional code (Comment) |
|
4 |
* Code generated for Simulink model 'pitch_ap'.
|
|
Nonfunctional code (Comment) |
|
5 |
*
|
|
Nonfunctional code (Comment) |
|
6 |
* Model version : 1.90
|
|
Nonfunctional code (Comment) |
|
7 |
* Simulink Coder version : 8.5 (R2013b) 08-Aug-2013
|
|
Nonfunctional code (Comment) |
|
8 |
* C/C++ source code generated on : Mon Feb 03 08:13:44 2014
|
|
Nonfunctional code (Comment) |
|
9 |
*
|
|
Nonfunctional code (Comment) |
|
10 |
* Target selection: ert.tlc
|
|
Nonfunctional code (Comment) |
|
11 |
* Embedded hardware selection: 32-bit Embedded Processor
|
|
Nonfunctional code (Comment) |
|
12 |
* Code generation objectives: Unspecified
|
|
Nonfunctional code (Comment) |
|
13 |
* Validation result: Not run
|
|
Nonfunctional code (Comment) |
|
14 |
*/
|
|
Nonfunctional code (Comment) |
|
15 |
|
|
Nonfunctional code (Empty line) |
|
16 |
#include "pitch_ap.h"
|
|
Not processed (Include statement) |
|
17 |
#include "pitch_ap_private.h"
|
|
Not processed (Include statement) |
|
18 |
|
|
Nonfunctional code (Empty line) |
|
19 |
/* Start for referenced model: 'pitch_ap' */
|
|
Nonfunctional code (Comment) |
|
20 |
void pitch_ap_Start(rtDW_pitch_ap *localDW)
|
|
- |
|
21 |
{
|
|
Nonfunctional code (Start of code segment) |
|
22 |
/* Start for ModelReference: '<Root>/Altitude Mode' */
|
|
Nonfunctional code (Comment) |
|
23 |
Altitude_Mode_Start(&(localDW->AltitudeMode_DWORK1.rtb));
|
|
- |
|
24 |
}
|
|
Nonfunctional code (End of code segment) |
|
25 |
|
|
Nonfunctional code (Empty line) |
|
26 |
/* Output and update for referenced model: 'pitch_ap' */
|
|
Nonfunctional code (Comment) |
|
27 |
void pitch_ap(const real_T *rtu_Phi, const real_T *rtu_Theta, const real_T
|
|
- |
|
28 |
*rtu_Q, const real_T *rtu_R, const real_T *rtu_Alt, const real_T
|
|
- |
|
29 |
*rtu_AltRate, const real_T *rtu_TAS, const boolean_T *rtu_APEng,
|
|
- |
|
30 |
const boolean_T *rtu_ALTMode, const real_T *rtu_AltRef, const
|
|
- |
|
31 |
real_T *rtu_PitchWheel, real_T *rty_ElvCmd, rtB_pitch_ap *localB,
... |
|
- |
|
32 |
rtDW_pitch_ap *localDW, real_T rtp_dispGain, real_T rtp_intGain,
|
|
- |
|
33 |
real_T rtp_rateGain)
|
|
- |
|
34 |
{
|
|
Nonfunctional code (Start of code segment) |
|
35 |
/* local block i/o variables */
|
|
Nonfunctional code (Comment) |
|
36 |
real_T rtb_AltitudeMode;
|
|
Local variable declaration |
|
37 |
real_T rtb_BasicPitchMode;
|
|
Local variable declaration |
|
38 |
real_T rtb_Sum3_pjva;
|
|
Local variable declaration |
|
39 |
real_T rtb_Sum3;
|
|
Local variable declaration |
|
40 |
real_T rtb_UnitConversion;
|
|
Local variable declaration |
|
41 |
real_T rtb_Xnew;
|
|
Local variable declaration |
|
42 |
|
|
Nonfunctional code (Empty line) |
|
43 |
/* ModelReference: '<Root>/Altitude Mode' */
|
|
Nonfunctional code (Comment) |
|
44 |
Altitude_Mode(rtu_AltRef, rtu_Alt, rtu_AltRate, rtu_TAS, rtu_Theta,
|
|
- |
|
45 |
rtu_ALTMode, &rtb_AltitudeMode,
|
|
- |
|
46 |
&(localDW->AltitudeMode_DWORK1.rtb),
|
|
- |
|
47 |
&(localDW->AltitudeMode_DWORK1.rtdw));
|
|
- |
|
48 |
|
|
Nonfunctional code (Empty line) |
|
49 |
/* Outputs for Atomic SubSystem: '<Root>/Pitch Reference' */
|
|
Nonfunctional code (Comment) |
|
50 |
/* Switch: '<S5>/Enable' incorporates:
|
|
Nonfunctional code (Comment) |
|
51 |
* Logic: '<S3>/Not engaged'
|
|
Nonfunctional code (Comment) |
|
52 |
* UnitDelay: '<S5>/FixPt Unit Delay1'
|
|
Nonfunctional code (Comment) |
|
53 |
*/
|
|
Nonfunctional code (Comment) |
|
54 |
if (!(*rtu_APEng)) {
|
|
- |
|
55 |
rtb_Xnew = *rtu_Theta;
|
|
- |
|
56 |
} else {
|
|
- |
|
57 |
rtb_Xnew = localDW->FixPtUnitDelay1_DSTATE;
|
|
- |
|
58 |
}
|
|
Nonfunctional code (End of code segment) |
|
59 |
|
|
Nonfunctional code (Empty line) |
|
60 |
/* End of Switch: '<S5>/Enable' */
|
|
Nonfunctional code (Comment) |
|
61 |
|
|
Nonfunctional code (Empty line) |
|
62 |
/* Sum: '<S3>/Sum3' incorporates:
|
|
Nonfunctional code (Comment) |
|
63 |
* UnitDelay: '<S5>/FixPt Unit Delay1'
|
|
Nonfunctional code (Comment) |
|
64 |
*/
|
|
Nonfunctional code (Comment) |
|
65 |
rtb_Sum3 = localDW->FixPtUnitDelay1_DSTATE + (*rtu_PitchWheel);
|
|
- |
|
66 |
|
|
Nonfunctional code (Empty line) |
|
67 |
/* Update for UnitDelay: '<S5>/FixPt Unit Delay1' */
|
|
Nonfunctional code (Comment) |
|
68 |
localDW->FixPtUnitDelay1_DSTATE = rtb_Xnew;
|
|
- |
|
69 |
|
|
Nonfunctional code (Empty line) |
|
70 |
/* End of Outputs for SubSystem: '<Root>/Pitch Reference' */
|
|
Nonfunctional code (Comment) |
|
71 |
|
|
Nonfunctional code (Empty line) |
|
72 |
/* Switch: '<Root>/Mode switch' */
|
|
Nonfunctional code (Comment) |
|
73 |
if (*rtu_ALTMode) {
|
|
- |
|
74 |
localB->thetaCmd = rtb_AltitudeMode;
|
|
- |
|
75 |
} else {
|
|
- |
|
76 |
localB->thetaCmd = rtb_Sum3;
|
|
- |
|
77 |
}
|
|
Nonfunctional code (End of code segment) |
|
78 |
|
|
Nonfunctional code (Empty line) |
|
79 |
/* End of Switch: '<Root>/Mode switch' */
|
|
Nonfunctional code (Comment) |
|
80 |
|
|
Nonfunctional code (Empty line) |
|
81 |
/* Outputs for Atomic SubSystem: '<Root>/Pitch Rate Feedback' */
|
|
Nonfunctional code (Comment) |
|
82 |
/* Gain: '<S4>/Unit Conversion' */
|
|
Nonfunctional code (Comment) |
|
83 |
rtb_UnitConversion = 0.017453292519943295 * (*rtu_Phi);
|
|
- |
|
84 |
|
|
Nonfunctional code (Empty line) |
|
85 |
/* Sum: '<S2>/Sum3' incorporates:
|
|
Nonfunctional code (Comment) |
|
86 |
* Product: '<S2>/Product'
|
|
Nonfunctional code (Comment) |
|
87 |
* Product: '<S2>/Product1'
|
|
Nonfunctional code (Comment) |
|
88 |
* Trigonometry: '<S2>/cos'
|
|
Nonfunctional code (Comment) |
|
89 |
* Trigonometry: '<S2>/sin'
|
|
Nonfunctional code (Comment) |
|
90 |
*/
|
|
Nonfunctional code (Comment) |
|
91 |
rtb_Sum3_pjva = (cos(rtb_UnitConversion) * (*rtu_Q)) + (sin(rtb_UnitConversion... |
|
- |
|
92 |
* (*rtu_R));
|
|
- |
|
93 |
|
|
Nonfunctional code (Empty line) |
|
94 |
/* End of Outputs for SubSystem: '<Root>/Pitch Rate Feedback' */
|
|
Nonfunctional code (Comment) |
|
95 |
|
|
Nonfunctional code (Empty line) |
|
96 |
/* ModelReference: '<Root>/Basic Pitch Mode' */
|
|
Nonfunctional code (Comment) |
|
97 |
attitude_controller(&localB->thetaCmd, rtu_Theta, &rtb_Sum3_pjva, rtu_APEng,
|
|
- |
|
98 |
&rtb_BasicPitchMode, &(localDW->BasicPitchMode_DWORK1.rtdw... |
|
- |
|
99 |
rtp_dispGain, 20.0, rtp_rateGain, 3.0, rtp_intGain, 5.0,
|
|
- |
|
100 |
20.0);
|
|
- |
|
101 |
|
|
Nonfunctional code (Empty line) |
|
102 |
/* Switch: '<Root>/Eng switch' incorporates:
|
|
Nonfunctional code (Comment) |
|
103 |
* Constant: '<Root>/Constant'
|
|
Nonfunctional code (Comment) |
|
104 |
*/
|
|
Nonfunctional code (Comment) |
|
105 |
if (*rtu_APEng) {
|
|
- |
|
106 |
*rty_ElvCmd = rtb_BasicPitchMode;
|
|
- |
|
107 |
} else {
|
|
- |
|
108 |
*rty_ElvCmd = 0.0;
|
|
- |
|
109 |
}
|
|
Nonfunctional code (End of code segment) |
|
110 |
|
|
Nonfunctional code (Empty line) |
|
111 |
/* End of Switch: '<Root>/Eng switch' */
|
|
Nonfunctional code (Comment) |
|
112 |
}
|
|
Nonfunctional code (End of code segment) |
|
113 |
|
|
Nonfunctional code (Empty line) |
|
114 |
/* Model initialize function */
|
|
Nonfunctional code (Comment) |
|
115 |
void pitch_ap_initialize(rtB_pitch_ap *localB, rtDW_pitch_ap *localDW)
|
|
- |
|
116 |
{
|
|
Nonfunctional code (Start of code segment) |
|
117 |
/* Registration code */
|
|
Nonfunctional code (Comment) |
|
118 |
|
|
Nonfunctional code (Empty line) |
|
119 |
/* block I/O */
|
|
Nonfunctional code (Comment) |
|
120 |
(void) memset(((void *) localB), 0,
|
|
- |
|
121 |
sizeof(rtB_pitch_ap));
|
|
- |
|
122 |
|
|
Nonfunctional code (Empty line) |
|
123 |
/* states (dwork) */
|
|
Nonfunctional code (Comment) |
|
124 |
(void) memset((void *)localDW, 0,
|
|
- |
|
125 |
sizeof(rtDW_pitch_ap));
|
|
- |
|
126 |
|
|
Nonfunctional code (Empty line) |
|
127 |
/* Model Initialize fcn for ModelReference Block: '<Root>/Altitude Mode' */
|
|
Nonfunctional code (Comment) |
|
128 |
Altitude_Mode_initialize(&(localDW->AltitudeMode_DWORK1.rtb),
|
|
- |
|
129 |
&(localDW->AltitudeMode_DWORK1.rtdw));
|
|
- |
|
130 |
|
|
Nonfunctional code (Empty line) |
|
131 |
/* Model Initialize fcn for ModelReference Block: '<Root>/Basic Pitch Mode' */... |
|
Nonfunctional code (Comment) |
|
132 |
attitude_controller_initialize(&(localDW->BasicPitchMode_DWORK1.rtdw));
|
|
- |
|
133 |
}
|
|
Nonfunctional code (End of code segment) |
|
134 |
|
|
Nonfunctional code (Empty line) |
|
135 |
/*
|
|
Nonfunctional code (Comment) |
|
136 |
* File trailer for generated code.
|
|
Nonfunctional code (Comment) |
|
137 |
*
|
|
Nonfunctional code (Comment) |
|
138 |
* [EOF]
|
|
Nonfunctional code (Comment) |
|
139 |
*/
|
|
Nonfunctional code (Comment) |